package com.yc.mvc.uitl;

import org.springframework.core.*;

import java.lang.reflect.Method;

public class Utils {
    private static DefaultParameterNameDisconverer dpnd = new DefaultParameterNameDisconverer();

    // 返回方法的参数名列表
    // 参考: https://www.jb51.net/article/232059.htm
    public static String[] getParameterNames(Method method){
        return dpnd.getParameterNames(method);
    }

}

class DefaultParameterNameDisconverer extends PrioritizedParameterNameDiscoverer{
    public DefaultParameterNameDisconverer() {
        if(KotlinDetector.isKotlinReflectPresent()){
            addDiscoverer(new KotlinReflectionParameterNameDiscoverer());
        }
        addDiscoverer(new StandardReflectionParameterNameDiscoverer());
        addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
    }
}
